package com.QLM.QLMFile.service.Impl;

import com.QLM.QLMFile.Vo.Admin;
import com.QLM.QLMFile.mapper.UserMapper;
import com.QLM.QLMFile.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("LoginService")
public class LoginServiceImpl implements LoginService {

    @Autowired
    private UserMapper userMapper;

    /*
    * 检查用户登录信息
    * */
    public Admin checkLogin(String username, String password) {
        Admin admin = userMapper.findByAdminname(username);

        if (admin != null && admin.getPassword().equals(password)){
            return admin;
        }
        return null;
    }

    @Override
    public void Regist(Admin admin) {

        userMapper.registerByUsernameAndPassword(admin.getUsername(),admin.getPassword());
    }


}
